package com.grf.controller;

import com.grf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
public class UserController {

    @Autowired
    private RestTemplate restTemplate;
    private static final String REST_URL_PREFIX = "http://client-9001";

    @ResponseBody
    @RequestMapping("/a")
    public User getUser() {
        return restTemplate.getForObject(REST_URL_PREFIX + "/getUser", User.class);
    }

}
